package com.ymatou.iapi.sellercs.service;

import java.util.ArrayList;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.ymatou.iapi.sellercs.parameter.GetCurrentSessionListResp;
import com.ymatou.iapi.sellercs.parameter.MessageResp;
import com.ymt.base.YmatouBaseCall;
import com.ymttest.business.service.SellerCSIMCallService;
import com.ymttest.utils.EnvSetup;
/**
*GetMessageList
*FreeMaker Template自动生成代码
*/
public class GetMessageListCall extends YmatouBaseCall{
	private static String opurl ="Api/Seller/GetMessageList";
	
	public GetMessageListCall() {
		super(EnvSetup.getSystemUrl("sellercs_iapi"),opurl,"GET","PARAM");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
		client.addHeader("ManualTurnTo", SellerCSIMCallService.ManualTurnTo);
	}
	public ArrayList<MessageResp> getResult() {
		ArrayList<MessageResp> result =new ArrayList<MessageResp>();
		try {
			Gson gson = new GsonBuilder().disableHtmlEscaping().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
			result=gson.fromJson(getString("Result"), new TypeToken<ArrayList<MessageResp>>() {}.getType());
//			result = (ArrayList<GetCurrentSessionListResp>)FormatUtil.GSONToObject(getString("Result"), new TypeToken<ArrayList<GetCurrentSessionListResp>>() {}.getType());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}
}